﻿Public Class frmConsultarMusculos

    Public lista As List(Of EntitiesLayer.Musculo)

    Public Sub frmConsultarMusculos_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        lista = objGestor.listarMusculos()

        tblMusculos.AutoGenerateColumns = False
        tblMusculos.DataSource = lista

        tblMusculos.Columns("Id").DataPropertyName = "Id"
        tblMusculos.Columns("Nombre").DataPropertyName = "Nombre"
        tblMusculos.Columns("Irrigacion").DataPropertyName = "Irrigacion"
        tblMusculos.Columns("Origen").DataPropertyName = "Origen"
        tblMusculos.Columns("Insercion").DataPropertyName = "Insercion"
        tblMusculos.Columns("Inervacion").DataPropertyName = "Inervacion"

    End Sub


    Private Sub btnRegistrarMusculo_Click(sender As Object, e As EventArgs) Handles btnRegistrarMusculo.Click

        FrmPrincipal.AddOwnedForm(frmTransparente)
        Dim frm As New FrmRegistrarMusculo()
        frm.Dock = DockStyle.Fill
        frmTransparente.AgregarContenido(frm)
        frmTransparente.Show()


    End Sub


    Private Sub txtFiltrarTabla_TextChanged(sender As Object, e As EventArgs) Handles txtFiltrarTabla.TextChanged

        Dim texto As String = txtFiltrarTabla.Text
        'lista = objGestor.filtrarListaMusculos(texto)

        tblMusculos.AutoGenerateColumns = False
        tblMusculos.DataSource = lista


    End Sub

    Private Sub btnInfoMusculo_Click(sender As Object, e As EventArgs) Handles btnInfoMusculo.Click

        FrmPrincipal.AddOwnedForm(frmTransparente)
        Dim frm As New FrmInfoMusculo()
        frm.Dock = DockStyle.Fill
        frmTransparente.AgregarContenido(frm)
        frmTransparente.Show()

        frm.txtId.Text = tblMusculos.SelectedCells(tblMusculos.Columns("Id").Index).FormattedValue.ToString()
        frm.txtNombre.Text = tblMusculos.SelectedCells(tblMusculos.Columns("Nombre").Index).FormattedValue.ToString()
        frm.txtIrrigacion.Text = tblMusculos.SelectedCells(tblMusculos.Columns("Irrigacion").Index).FormattedValue.ToString()
        frm.txtOrigen.Text = tblMusculos.SelectedCells(tblMusculos.Columns("Origen").Index).FormattedValue.ToString()
        frm.txtInsercion.Text = tblMusculos.SelectedCells(tblMusculos.Columns("Insercion").Index).FormattedValue.ToString()
        frm.txtInervacion.Text = tblMusculos.SelectedCells(tblMusculos.Columns("Inervacion").Index).FormattedValue.ToString()

    End Sub

    Private Sub tblMusculos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles tblMusculos.CellContentClick

    End Sub
End Class
